package com.dream.keigezhushou.Activity.activity;

import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.dream.keigezhushou.Activity.Uiutils.UiUtils;
import com.dream.keigezhushou.Activity.wigdt.NoScrollListview;
import com.dream.keigezhushou.R;

import butterknife.BindView;
import butterknife.ButterKnife;

public class KtvActivity extends BaseActivity {

    @BindView(R.id.back)
    ImageView mBack;
    @BindView(R.id.title)
    TextView mTitle;
    @BindView(R.id.shoucang)
    ImageView mShoucang;
    @BindView(R.id.share)
    ImageView mShare;
    @BindView(R.id.rl)
    RelativeLayout mRl;
    @BindView(R.id.des)
    TextView mDes;

    @BindView(R.id.tv)
    TextView mTv;
    @BindView(R.id.line)
    View mLine;
    @BindView(R.id.validity)
    TextView mValidity;
    @BindView(R.id.time)
    TextView mTime;
    @BindView(R.id.subscribe)
    TextView mSubscribe;
    @BindView(R.id.des_yuyue)
    TextView mDesYuyue;
    @BindView(R.id.info)
    TextView mInfo;
    @BindView(R.id.infodes)
    TextView mInfodes;
    @BindView(R.id.service)
    TextView mService;
    @BindView(R.id.service_des1)
    TextView mServiceDes1;
    @BindView(R.id.service_des2)
    TextView mServiceDes2;
    @BindView(R.id.hint)
    TextView mHint;
    @BindView(R.id.hint_des1)
    TextView mHintDes1;
    @BindView(R.id.hint_des2)
    TextView mHintDes2;
    @BindView(R.id.activity_ktv)
    LinearLayout mActivityKtv;
    @BindView(R.id.images)
    NoScrollListview mImages;

    private int[] images = {R.mipmap.image_o, R.mipmap.image_t, R.mipmap.image_s, R.mipmap.image_f, R.mipmap.image_g};


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_ktv);
        ButterKnife.bind(this);

        mImages.setFocusable(false);

       Myadapter myadapter = new Myadapter();
        mImages.setAdapter(myadapter);

    }


    private class Myadapter extends BaseAdapter {
        @Override
        public int getCount() {
            return images.length;
        }

        @Override
        public Object getItem(int position) {
            return images[position];
        }

        @Override
        public long getItemId(int position) {
            return position;
        }

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            Viewholder holder = null;
            if (convertView == null) {
                convertView = UiUtils.inflateView(R.layout.images);
                holder = new Viewholder();
                holder.iv = (ImageView) convertView.findViewById(R.id.icon);
                convertView.setTag(holder);
            } else {
                holder = (Viewholder) convertView.getTag();
            }

            Object item = getItem(position);
            holder.iv.setImageResource(images[position]);
            return convertView;
        }
    }

    static class Viewholder {
        ImageView iv;
    }
}
